get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 68233,
    "url": "http://patchwork.dpdk.org/api/patches/68233/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1586740309-449310-8-git-send-email-suanmingm@mellanox.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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-8-git-send-email-suanmingm@mellanox.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1586740309-449310-8-git-send-email-suanmingm@mellanox.com",
    "date": "2020-04-13T01:11:46",
    "name": "[07/10] net/mlx5: convert port id action to indexed",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "76323470e1ca7f7128cf2488b62a3a49963a26eb",
    "submitter": {
        "id": 1358,
        "url": "http://patchwork.dpdk.org/api/people/1358/?format=api",
        "name": "Suanming Mou",
        "email": "suanmingm@mellanox.com"
    },
    "delegate": {
        "id": 3268,
        "url": "http://patchwork.dpdk.org/api/users/3268/?format=api",
        "username": "rasland",
        "first_name": "Raslan",
        "last_name": "Darawsheh",
        "email": "rasland@nvidia.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/1586740309-449310-8-git-send-email-suanmingm@mellanox.com/mbox/",
    "series": [
        {
            "id": 9321,
            "url": "http://patchwork.dpdk.org/api/series/9321/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=9321",
            "date": "2020-04-13T01:11:39",
            "name": "net/mlx5: optimize flow resource allocation",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/9321/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/68233/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/68233/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 B04C7A0577;\n\tMon, 13 Apr 2020 03:13:07 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 5DB0A1BF59;\n\tMon, 13 Apr 2020 03:12:11 +0200 (CEST)",
            "from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130])\n by dpdk.org (Postfix) with ESMTP id 3A82B1BF26\n for <dev@dpdk.org>; Mon, 13 Apr 2020 03:12:09 +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:46 +0800",
        "Message-Id": "<1586740309-449310-8-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 07/10] net/mlx5: convert port id action 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 converts port id action to indexed.\n\nUsing the uint32_t index instead of pointer saves 4 bytes memory for the\nflow handle. For millions flows, it will save several MBytes of memory.\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         |  4 ++--\n drivers/net/mlx5/mlx5_flow.h    |  6 ++++--\n drivers/net/mlx5/mlx5_flow_dv.c | 43 +++++++++++++++++++++++++++++------------\n 4 files changed, 48 insertions(+), 16 deletions(-)",
    "diff": "diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c\nindex 798df18..4477755 100644\n--- a/drivers/net/mlx5/mlx5.c\n+++ b/drivers/net/mlx5/mlx5.c\n@@ -228,6 +228,17 @@ struct mlx5_dev_spawn_data {\n \t\t.free = rte_free,\n \t\t.type = \"mlx5_tag_ipool\",\n \t},\n+\t{\n+\t\t.size = sizeof(struct mlx5_flow_dv_port_id_action_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_port_id_ipool\",\n+\t},\n };\n \n \ndiff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h\nindex 6c25d6a..5f38587 100644\n--- a/drivers/net/mlx5/mlx5.h\n+++ b/drivers/net/mlx5/mlx5.h\n@@ -55,6 +55,7 @@ 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_PORT_ID, /* Pool for port id resource. */\n \tMLX5_IPOOL_MAX,\n };\n \n@@ -456,8 +457,7 @@ struct mlx5_ibv_shared {\n \tuint32_t encaps_decaps; /* Encap/decap action indexed memory list. */\n \tLIST_HEAD(modify_cmd, mlx5_flow_dv_modify_hdr_resource) modify_cmds;\n \tstruct mlx5_hlist *tag_table;\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+\tuint32_t port_id_action_list; /* List of port ID actions. */\n \tuint32_t push_vlan_action_list; /* List of push VLAN actions. */\n \tstruct mlx5_flow_counter_mng cmng; /* Counters management structure. */\n \tstruct mlx5_indexed_pool *ipool[MLX5_IPOOL_MAX];\ndiff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h\nindex 6364bfe..5cd9d67 100644\n--- a/drivers/net/mlx5/mlx5_flow.h\n+++ b/drivers/net/mlx5/mlx5_flow.h\n@@ -420,7 +420,7 @@ struct mlx5_flow_dv_jump_tbl_resource {\n \n /* Port ID resource structure. */\n struct mlx5_flow_dv_port_id_action_resource {\n-\tLIST_ENTRY(mlx5_flow_dv_port_id_action_resource) next;\n+\tILIST_ENTRY(uint32_t)next;\n \t/* Pointer to next element. */\n \trte_atomic32_t refcnt; /**< Reference counter. */\n \tvoid *action;\n@@ -489,7 +489,7 @@ struct mlx5_flow_handle_dv {\n \t/**< Pointer to modify header resource in cache. */\n \tstruct mlx5_flow_dv_jump_tbl_resource *jump;\n \t/**< Pointer to the jump action resource. */\n-\tstruct mlx5_flow_dv_port_id_action_resource *port_id_action;\n+\tuint32_t port_id_action;\n \t/**< Pointer to port ID action resource. */\n \tstruct mlx5_vf_vlan vf_vlan;\n \t/**< Structure for VF VLAN workaround. */\n@@ -549,6 +549,8 @@ struct mlx5_flow_dv_workspace {\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+\tstruct mlx5_flow_dv_port_id_action_resource *port_id_action;\n+\t/**< Pointer to port ID action 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. */\ndiff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c\nindex 07ec629..49c0a6d 100644\n--- a/drivers/net/mlx5/mlx5_flow_dv.c\n+++ b/drivers/net/mlx5/mlx5_flow_dv.c\n@@ -2569,21 +2569,25 @@ struct field_modify_info modify_tcp[] = {\n \tstruct mlx5_priv *priv = dev->data->dev_private;\n \tstruct mlx5_ibv_shared *sh = priv->sh;\n \tstruct mlx5_flow_dv_port_id_action_resource *cache_resource;\n+\tuint32_t idx = 0;\n \n \t/* Lookup a matching resource from cache. */\n-\tLIST_FOREACH(cache_resource, &sh->port_id_action_list, next) {\n+\tILIST_FOREACH(sh->ipool[MLX5_IPOOL_PORT_ID], sh->port_id_action_list,\n+\t\t      idx, cache_resource, next) {\n \t\tif (resource->port_id == cache_resource->port_id) {\n \t\t\tDRV_LOG(DEBUG, \"port id action resource resource %p: \"\n \t\t\t\t\"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->handle->dvh.port_id_action = cache_resource;\n+\t\t\tdev_flow->handle->dvh.port_id_action = idx;\n+\t\t\tdev_flow->dv.port_id_action = cache_resource;\n \t\t\treturn 0;\n \t\t}\n \t}\n \t/* Register new port id action resource. */\n-\tcache_resource = rte_calloc(__func__, 1, sizeof(*cache_resource), 0);\n+\tcache_resource = mlx5_ipool_zmalloc(sh->ipool[MLX5_IPOOL_PORT_ID],\n+\t\t\t\t       &dev_flow->handle->dvh.port_id_action);\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@@ -2605,8 +2609,10 @@ struct field_modify_info modify_tcp[] = {\n \t}\n \trte_atomic32_init(&cache_resource->refcnt);\n \trte_atomic32_inc(&cache_resource->refcnt);\n-\tLIST_INSERT_HEAD(&sh->port_id_action_list, cache_resource, next);\n-\tdev_flow->handle->dvh.port_id_action = cache_resource;\n+\tILIST_INSERT(sh->ipool[MLX5_IPOOL_PORT_ID], &sh->port_id_action_list,\n+\t\t     dev_flow->handle->dvh.port_id_action, cache_resource,\n+\t\t     next);\n+\tdev_flow->dv.port_id_action = cache_resource;\n \tDRV_LOG(DEBUG, \"new port id action resource %p: refcnt %d++\",\n \t\t(void *)cache_resource,\n \t\trte_atomic32_read(&cache_resource->refcnt));\n@@ -7406,12 +7412,14 @@ struct field_modify_info modify_tcp[] = {\n \t\t\tif (flow_dv_translate_action_port_id(dev, action,\n \t\t\t\t\t\t\t     &port_id, error))\n \t\t\t\treturn -rte_errno;\n+\t\t\tmemset(&port_id_resource, 0, sizeof(port_id_resource));\n \t\t\tport_id_resource.port_id = port_id;\n \t\t\tif (flow_dv_port_id_action_resource_register\n \t\t\t    (dev, &port_id_resource, dev_flow, error))\n \t\t\t\treturn -rte_errno;\n+\t\t\tMLX5_ASSERT(!handle->dvh.port_id_action);\n \t\t\tdev_flow->dv.actions[actions_n++] =\n-\t\t\t\t\thandle->dvh.port_id_action->action;\n+\t\t\t\t\tdev_flow->dv.port_id_action->action;\n \t\t\taction_flags |= MLX5_FLOW_ACTION_PORT_ID;\n \t\t\tbreak;\n \t\tcase RTE_FLOW_ACTION_TYPE_FLAG:\n@@ -8296,6 +8304,8 @@ struct field_modify_info modify_tcp[] = {\n /**\n  * Release port ID action resource.\n  *\n+ * @param dev\n+ *   Pointer to Ethernet device.\n  * @param handle\n  *   Pointer to mlx5_flow_handle.\n  *\n@@ -8303,11 +8313,17 @@ struct field_modify_info modify_tcp[] = {\n  *   1 while a reference on it exists, 0 when freed.\n  */\n static int\n-flow_dv_port_id_action_resource_release(struct mlx5_flow_handle *handle)\n+flow_dv_port_id_action_resource_release(struct rte_eth_dev *dev,\n+\t\t\t\t\tstruct mlx5_flow_handle *handle)\n {\n-\tstruct mlx5_flow_dv_port_id_action_resource *cache_resource =\n-\t\t\t\t\t\thandle->dvh.port_id_action;\n+\tstruct mlx5_priv *priv = dev->data->dev_private;\n+\tstruct mlx5_flow_dv_port_id_action_resource *cache_resource;\n+\tuint32_t idx = handle->dvh.port_id_action;\n \n+\tcache_resource = mlx5_ipool_get(priv->sh->ipool[MLX5_IPOOL_PORT_ID],\n+\t\t\t\t\tidx);\n+\tif (!cache_resource)\n+\t\treturn 0;\n \tMLX5_ASSERT(cache_resource->action);\n \tDRV_LOG(DEBUG, \"port ID action resource %p: refcnt %d--\",\n \t\t(void *)cache_resource,\n@@ -8315,8 +8331,10 @@ 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\trte_free(cache_resource);\n+\t\tILIST_REMOVE(priv->sh->ipool[MLX5_IPOOL_PORT_ID],\n+\t\t\t     &priv->sh->port_id_action_list, idx,\n+\t\t\t     cache_resource, next);\n+\t\tmlx5_ipool_free(priv->sh->ipool[MLX5_IPOOL_PORT_ID], idx);\n \t\tDRV_LOG(DEBUG, \"port id action resource %p: removed\",\n \t\t\t(void *)cache_resource);\n \t\treturn 0;\n@@ -8435,7 +8453,8 @@ struct field_modify_info modify_tcp[] = {\n \t\tif (dev_handle->dvh.jump)\n \t\t\tflow_dv_jump_tbl_resource_release(dev, dev_handle);\n \t\tif (dev_handle->dvh.port_id_action)\n-\t\t\tflow_dv_port_id_action_resource_release(dev_handle);\n+\t\t\tflow_dv_port_id_action_resource_release(dev,\n+\t\t\t\t\t\t\t\tdev_handle);\n \t\tif (dev_handle->dvh.push_vlan_res)\n \t\t\tflow_dv_push_vlan_action_resource_release(dev,\n \t\t\t\t\t\t\t\t  dev_handle);\n",
    "prefixes": [
        "07/10"
    ]
}